package com.shujia.profile.info.natural

import com.shujia.profile.UserProfile
import com.shujia.util.SparkUtil
import org.apache.spark.sql.{DataFrame, Row, SparkSession}

class UserProfileSex extends UserProfile {

  flagName = "sex"

  override def extractProfile(spark: SparkSession): DataFrame = {

    import spark.implicits._

    //获取用户维度表
    val member: DataFrame = spark.table("dim.dim_pub_t_member")

    //提取性别画像
    member.select($"id", $"sex")
  }
}

object UserProfileSex {
  def main(args: Array[String]): Unit = {
    //获取参数,在提交任务时，在包名后面增加的参数
    val ds: String = args.head
    //spark环境
    val spark: SparkSession = SparkUtil.getSession()

    new UserProfileSex().run(spark, ds)
  }
}
